package com;
import java.util.concurrent.CountDownLatch;
public class YootkDemo7 {
    public static void main(String[] args) throws Exception{
        CountDownLatch latch = new CountDownLatch(2);
        for (int x = 0; x < 2; x++){
            new Thread(() -> {
                System.out.println("【" + Thread.currentThread().getName() + "】达到并已上车。");
                latch.countDown();
            },"客人 - " + x).start();
        }
        latch.await();
        System.out.println("【主线程】人齐了，开车走人。");
    }
}
